<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
	<th:block th:include="include :: header('数据统计')" />
</head>
<body class="gray-bg">
    <div class="wrapper wrapper-content animated fadeInRight">
        <div class="row">
            <div class="col-sm-3">
                <div class="ibox">
                    <div class="ibox-content">
                        <h5>历史充值金额</h5>
                        <h1 id="packageSum" class="no-margins">0</h1>
                    </div>
                </div>
            </div>
            <div class="col-sm-3">
                <div class="ibox">
                    <div class="ibox-content">
                        <h5>任务总数</h5>
                        <h1 id="taskCount" class="no-margins">0</h1>
                    </div>
                </div>
            </div>
            <div class="col-sm-3">
                <div class="ibox">
                    <div class="ibox-content">
                        <h5>用户总数 VS VIP总数</h5>
                        <h1 style="display: inline-block;" id="userCount" class="no-margins">0</h1><h3 style="display: inline-block;">&nbsp;&nbsp;vs&nbsp;&nbsp;</h3><h1 style="display: inline-block;" id="vipCount" class="no-margins">0</h1>
                    </div>
                </div>
            </div>
            <div class="col-sm-3">
                <div class="ibox">
                    <div class="ibox-content">
                        <h5>代理总数</h5>
                        <h1 id="agentCount" class="no-margins">0</h1>
                    </div>
                </div>
            </div>

        </div>
        <div class="row">
            <div class="col-sm-3">
                <div class="ibox">
                    <div class="ibox-content">
                        <h5>代理用户账户总额</h5>
                        <!--<h1 id="rechargeSum" class="no-margins">0</h1>-->
                        <h1 id="balanceSum" class="no-margins">0</h1>
                    </div>
                </div>
            </div>
            <div class="col-sm-3">
                <div class="ibox">
                    <div class="ibox-content">
                        <h5>代理已提现总额 VS 待提现总额</h5>
                        <!--<h1 id="withdrawSum" class="no-margins">0</h1>-->
                        <h1 style="display: inline-block;" id="endWithdrawSum" class="no-margins">0</h1><h3 style="display: inline-block;">&nbsp;&nbsp;vs&nbsp;&nbsp;</h3><h1 style="display: inline-block;" id="unagentShareCount" class="no-margins">0</h1>
                    </div>
                </div>
            </div>
            <div class="col-sm-3">
                <div class="ibox">
                    <div class="ibox-content">
                        <h5>代理奖励总额</h5>
                        <h1 id="agentShareCount" class="no-margins">0</h1>
                    </div>
                </div>
            </div>
            <div class="col-sm-3">
                <div class="ibox">
                    <div class="ibox-content">
                        <h5>代理兑换积分总额</h5>
                        <!--<h1 id="chunSum" class="no-margins">0</h1>-->
                        <h1 id="exchangeSum" class="no-margins">0</h1>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <div class="container-div">
        <div class="row">
            <div class="col-sm-12 search-collapse">
                <form id="formId">
                    <div class="select-list">
                        <ul>
                            <li>
                                <label style="width: 100px">年份：</label>
                                <input type="text" id="yearSearch" name="yearSearch"/>
                            </li>
                            <li>
                                <label style="width: 100px">月份：</label>
                                <input type="text" id="monthSearch" name="monthSearch"/>
                            </li>
                            <li>
                                <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
                                <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
                            </li>
                        </ul>
                    </div>
                </form>
            </div>
            <div class="col-sm-12 select-table table-striped">
                <table id="bootstrap-table"></table>
            </div>
        </div>
    </div>

    <th:block th:include="include :: footer" />
    <th:block th:include="include :: peity-js" />
    <script type="text/javascript">
        $(document).ready(function () {
            $("#sparkline1").sparkline([34, 43, 43, 35, 44, 32, 44, 52], {
                type: 'line',
                width: '100%',
                height: '60',
                lineColor: '#1ab394',
                fillColor: "#ffffff"
            });

            $("#sparkline2").sparkline([24, 43, 43, 55, 44, 62, 44, 72], {
                type: 'line',
                width: '100%',
                height: '60',
                lineColor: '#1ab394',
                fillColor: "#ffffff"
            });

            $("#sparkline3").sparkline([74, 43, 23, 55, 54, 32, 24, 12], {
                type: 'line',
                width: '100%',
                height: '60',
                lineColor: '#ed5565',
                fillColor: "#ffffff"
            });

            $("#sparkline4").sparkline([24, 43, 33, 55, 64, 72, 44, 22], {
                type: 'line',
                width: '100%',
                height: '60',
                lineColor: '#ed5565',
                fillColor: "#ffffff"
            });

            $("#sparkline5").sparkline([1, 4], {
                type: 'pie',
                height: '140',
                sliceColors: ['#1ab394', '#F5F5F5']
            });

            $("#sparkline6").sparkline([5, 3], {
                type: 'pie',
                height: '140',
                sliceColors: ['#1ab394', '#F5F5F5']
            });

            $("#sparkline7").sparkline([2, 2], {
                type: 'pie',
                height: '140',
                sliceColors: ['#ed5565', '#F5F5F5']
            });

            $("#sparkline8").sparkline([2, 3], {
                type: 'pie',
                height: '140',
                sliceColors: ['#ed5565', '#F5F5F5']
            });
        });

        $(function() {
            $("span.pie").peity("pie", {
                fill: ['#1ab394', '#d7d7d7', '#ffffff']
            })

            $(".line").peity("line",{
                fill: '#1ab394',
                stroke:'#169c81',
            })

            $(".bar").peity("bar", {
                fill: ["#1ab394", "#d7d7d7"]
            })

            $(".bar_dashboard").peity("bar", {
                fill: ["#1ab394", "#d7d7d7"],
                width:100
            })

            var updatingChart = $(".updating-chart").peity("line", { fill: '#1ab394',stroke:'#169c81', width: 64 })

            setInterval(function() {
                var random = Math.round(Math.random() * 10)
                var values = updatingChart.text().split(",")
                values.shift()
                values.push(random)

                updatingChart
                    .text(values.join(","))
                    .change()
            }, 1000);
        });

        /* var editFlag = [[${@permission.hasPermi('lm:report:edit')}]];
         var removeFlag = [[${@permission.hasPermi('lm:report:remove')}]];*/
        var prefix = ctx + "whzj/report";

        $(function() {
            var options = {
                url: prefix + "/list",
                createUrl: prefix + "/add",
                updateUrl: prefix + "/edit/{id}",
                removeUrl: prefix + "/remove",
                exportUrl: prefix + "/export",
                modalName: "数据统计",
                columns: [{
                    checkbox: true
                },
                    {
                        field: 'reportDate',
                        title: '日期'
                    },
                    {
                        field: 'userCount',
                        title: '用户注册数'
                    }
                    ,
                    {
                        field: 'vipCount',
                        title: '充值用户数'
                    }
                    ,
                    {
                        field: 'rechargeSum',
                        title: '充值金额'
                    },
                    {
                        field: 'agentShareCount',
                        title: '奖励代理金额'
                    }
                    ,
                    /*{
                        field: 'inCount',
                        title: '应收入金额'
                    }
                    ,*/
                    {
                        field: 'agentCount',
                        title: '开通代理数'
                    }
                    ,
                    {
                        field: 'unagentShareCount',
                        title: '未提现金额'
                    },
                    {
                        field: 'withdrawSum',
                        title: '提现金额'
                    },
                    /*{
                        field: 'chunSum',
                        title: '净收入'
                    }*/] ,
                    onLoadSuccess: function () {
                        //统计总额
                        $.ajax({
                            type: "post",
                            url: prefix + "/getCount?yearSearch="+$("#yearSearch").val()+"&monthSearch="+$("#monthSearch").val(),
                            success: function(r) {
                                debugger;
                                /*$("#chunSum").html(r.data.chunSum);*/
                                $("#packageSum").html(r.data.packageSum);
                                /*$("#rechargeSum").html(r.data.rechargeSum);*/
                                /*$("#withdrawSum").html(r.data.withdrawSum);*/
                                $("#taskCount").html(r.data.taskCount);
                                $("#vipCount").html(r.data.vipCount);
                                $("#userCount").html(r.data.userCount);
                                $("#agentCount").html(r.data.agentCount);
                                $("#agentShareCount").html(r.data.agentShareCount);
                                $("#unagentShareCount").html(r.data.unagentShareCount);
                                $("#enagentShareCount").html(r.data.enagentShareCount);
                                $("#exchangeSum").html(r.data.exchangeSum);
                                $("#endWithdrawSum").html(r.data.endWithdrawSum);
                                $("#balanceSum").html(r.data.balanceSum);
                            }
                        });
                    }
            };

            $.table.init(options);


        });

    </script>
    <th:block th:include="include :: sparkline-js" />
</body>
</html>